package config

import (
	"fmt"
	"github.com/spf13/viper"
)

type Config struct {
	Nacos struct {
		Host   string
		Port   uint64
		Name   string
		DataId string
		Group  string
	}
}

var Conf Config

func GetViper() {
	viper.SetConfigFile("./config/server.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic("配置文件读取失败")
	}
	err = viper.Unmarshal(&Conf)
	if err != nil {
		panic("配置文件解析失败")
	}
	fmt.Println("viper成功")
}
